﻿$(document).ready(function(){
	getOrgInfo();
	getEthicsCommitteeRecordsList();
});
function getOrgInfo() {
	$.ajax({
   		async:false,
		url:'/ethicsCommittee_records/ethics-committee-records!findUserOrgById.action',
		type:'POST',
		data:{
			"id":id
		},
		dataType:'json',
		cache: false,
		success:function(data){
			Interceptor(data);
			var sjreson="";
			var baocunIdStr="";
			
			if(data!=null){
				var dataObj=data.org;
				var status = dataObj.status;
				 
				$("#id").val(dataObj.ID);
				$("#name").val(dataObj.name);
				$("#organType").val(dataObj.organType);
				$("#organLevel").val(dataObj.organLevel);
				$("#organCode").val(dataObj.organCode);
				$("#address").val(dataObj.address);
				$("#postCode").val(dataObj.postCode);
				$("#contactUser").val(dataObj.contactUser);
				$("#contactPhone").val(dataObj.contactPhone);
				$("#contactMobile").val(dataObj.contactMobile);
				$("#contactEmail").val(dataObj.contactEmail);
				$("#province_li").html(dataObj.province.name);
				$("#responsiblePerson").val(dataObj.responsiblePerson);

			}
			
		},
		error:function(){
			//nexts(tag);
		}
	});
}

function organTypeHandle(value){
  if(value=='其他') {
  	$("#ul_organLevel").hide();
  }else if(value=='医院') {
  	$("#ul_organLevel").show();
  }
}

// 查询证书列表
function getEthicsCommitteeRecordsList() {
	var status = $("#status").val();
	$.ajax({
		url : '/ethicsCommittee_records/ethics-committee-records!getEthicsCommitteeRecordsListParticulars.action',
		type : 'post',
		data:{
			"id":id
		},
		dataType: 'json',
		success : function(data) {
			 var resultContent = '<tr>'
		      	+'<th style="text-align: left; width: 20%">伦理委员会名称</th>'
		      	+'<th style="text-align: left;">伦理委员会组成成员名单</th>'
		      	+'<th style="text-align: left;">伦理委员会联系电话</th>'
		      	+'<th style="text-align: left;">伦理委员会电子邮箱</th>'
		      	+'<th style="text-align: left;">批准附件</th>'
		      /*	+'<th style="text-align: left;">状态</th>'*/
		      +'</tr>';
		     $(data).each(function(i) {
		    	 if(data[i].status == '1'){
		    	 resultContent+='<tr>'
				        +'<td>' + data[i].name + '</td>'
				        +'<td>' + data[i].memberName + '</td>'
				        +'<td>' + data[i].telphone + '</td>'
				        +'<td>' + data[i].email + '</td>'
				        +'<td><a href="' + data[i].attachmentPath + '" target="_blank" >查看/下载</a></td>';
		    	 
		    	 /*	if(data[i].status == '-1'){
		    	 		resultContent+='<td>草稿</td>';
		    	 	}
		    	 	if(data[i].status == '0'){
		    	 		resultContent+='<td>待审核</td>';
		    	 	}
		    	 	
		    	 	if(data[i].status == '2'){
		    	 		resultContent+='<td>审核未通过</td>';
		    	 	}*/
		    	 		resultContent+='</tr>';
		    	 }
		     });
		     if(data==null || data=='') {
		     	 resultContent+='<tr><td colspan="5" style="text-align:center; height:40px;">数据为空！</td></tr>';
		     }
		     $("#ethics_committee_records_data").html(resultContent);
		},
		error : function(X) {
			// 失败
		}
    });
}
//返回列表
function goList(){
	location.href='/index/ethicscommittee_records_search.jsp';
	
}